//
//  MineHeaderView.m
//  HappyRent
//
//  Created by CoderYee on 2017/3/28.
//  Copyright © 2017年 内圈科技. All rights reserved.
//

#import "MineHeaderView.h"

@implementation MineHeaderView

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self=[super initWithFrame:frame]) {
       
        [self addOwnView];
        [self bindViewModel];
    }
    return self;
}
-(void)addOwnView{
    
    UIView  *backView=[[UIView alloc] init];
    backView.autoresizingMask=UIViewAutoresizingFlexibleBottomMargin;
    [backView setBackgroundColor:kNavBarThemeColor];
    [self addSubview:backView];
    [backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self);
        make.height.mas_equalTo(700);
        make.bottom.equalTo(self);
    }];
    
    _headerImageView=[[UIImageView alloc] init];
    _headerImageView.contentMode=UIViewContentModeScaleAspectFill;
    _headerImageView.clipsToBounds=YES;
    _headerImageView.layer.masksToBounds=YES;
    _headerImageView.layer.cornerRadius=30.0f;
    [_headerImageView setImage:[UIImage imageNamed:@"4"]];
    [self addSubview:_headerImageView];
    
    [_headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.centerY.equalTo(self).with.offset(-20);
        make.height.width.mas_equalTo(60);
    }];
    
    _nickNameLable=[[UILabel alloc] init];
    _nickNameLable.textColor=kWhiteColor;
    _nickNameLable.text=@"快乐租";
    [self addSubview:_nickNameLable];
    [_nickNameLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(_headerImageView.mas_bottom).offset(5);
        make.height.mas_equalTo(30);
    }];
    UITapGestureRecognizer   *ges=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickheaderView:)];
    [self addGestureRecognizer:ges];
}
-(void)bindViewModel{
    
    _clickSubject=[RACSubject subject];
    
}
-(void)clickheaderView:(UIGestureRecognizer *)ges{
    
    [_clickSubject sendNext:self];
}
@end
